﻿#region

using System;
using System.Collections.Generic;
using HouseHoldBudget.Core.Entities.User;
using HouseHoldBudget.Framework.Session;

#endregion

namespace HouseHoldBudget.Models.Common
{
    public class MenuModel
    {
        #region Constructors

        public MenuModel()
        {
            CurrentBudgetUser = SessionPersister.CurrentBudgetUser;

            if(CurrentBudgetUser != null)
                BuildAdminMenus();
        }

        #endregion

        #region Instance Properties

        public List<HomeMenuItem> AdminMenus { get; private set; }
        public BudgetUser CurrentBudgetUser { get; private set; }

        #endregion

        #region Instance Methods

        private void BuildAdminMenus()
        {
            AdminMenus = new List<HomeMenuItem>
                             {
                                 new HomeMenuItem
                                     {
                                         Name = "Mes budgets",
                                         IconUri = new Uri("budget.png", UriKind.Relative),
                                         ImageUrl = "budget.png",
                                         IsAuthorized = true,
                                         ControllerName = "Budget",
                                         ActionName = "ShowAllBudgets",
                                         SubMenus = new List<HomeMenuItem>
                                                        {
                                                            new HomeMenuItem
                                                                {
                                                                    Name = "Consulter un budget",
                                                                    ControllerName = "Budget",
                                                                    ActionName = "ShowAllBudgets",
                                                                    IsAuthorized = true,
                                                                },
                                                            new HomeMenuItem
                                                                {
                                                                    Name = "Gérer mes budgets",
                                                                    ControllerName = "Budget",
                                                                    ActionName = "ManageMyBudgets",
                                                                    IsAuthorized = true,
                                                                },
                                                            new HomeMenuItem
                                                                {
                                                                    Name = "Gérer mes dépenses",
                                                                    ControllerName = "Expenses",
                                                                    ActionName = "ShowMyExpenses",
                                                                    IsAuthorized = true,
                                                                },
                                                            new HomeMenuItem
                                                                {
                                                                    Name = "Gérer mes revenus",
                                                                    ControllerName = "Incomes",
                                                                    ActionName = "ShowMyIncomes",
                                                                    IsAuthorized = true,
                                                                },
                                                        }
                                     },
                                 new HomeMenuItem
                                     {
                                         Name = "Mes documents",
                                         IsAuthorized = true,
                                         ControllerName = "Documents",
                                         ActionName = "MyDocuments",
                                         IconUri = new Uri("ico-documents.png", UriKind.Relative),
                                         SubMenus = new List<HomeMenuItem>
                                                        {
                                                            new HomeMenuItem
                                                                {
                                                                    Name = "Ajouter un document",
                                                                    ControllerName = "Documents",
                                                                    ActionName = "AddDocuments",
                                                                    IsAuthorized = true,
                                                                },
                                                            new HomeMenuItem
                                                                {
                                                                    Name = "Rechercher un document",
                                                                    ControllerName = "Documents",
                                                                    ActionName = "MyDocuments",
                                                                    IsAuthorized = true,
                                                                },
                                                        }
                                     },
                                 new HomeMenuItem
                                     {
                                         Name = "Rapports",
                                         IsAuthorized = true,
                                         ControllerName = "Parameters",
                                         ActionName = "ManageExpenseTypes",
                                         IconUri = new Uri("ico-stat1.gif", UriKind.Relative),
                                     },
                                 new HomeMenuItem
                                     {
                                         Name = "Paramétrages",
                                         IsAuthorized = true,
                                         ControllerName = "Expenses",
                                         ActionName = "ManageExpenseTypes",
                                         IconUri = new Uri("ico-configuration.png", UriKind.Relative),
                                         SubMenus = new List<HomeMenuItem>
                                                        {
                                                            new HomeMenuItem
                                                                {
                                                                    Name = "Ajouter des types de dépenses",
                                                                    ControllerName = "Expenses",
                                                                    ActionName = "ManageExpenseTypes",
                                                                    IsAuthorized = true,
                                                                },
                                                        }
                                     },
                             };
        }

        #endregion
    }
}